
--[[
普攻几率/间隔触发
]]
local mt = ac.skill['攻击触发']
mt.art = [[ReplaceableTextures\CommandButtons\BTNOrbOfLightning.blp]]
mt.odds = 100   --触发几率
mt.bind = nil   --绑定技能


function mt:on_add()
    local hero = self.owner
    self.bind_skill = self
    if self.bind then
        self.bind_skill = hero:add_skill(self.bind,'隐藏')
        self:gc(self.bind_skill)
    end
    for k,v in sortpairs(self.effect_data or {}) do
        if type(v) == 'table' then
            for o,e in sortpairs (v) do
                self:gc(hero:add_effect(e,k))
            end
        else
            self:gc(hero:add_effect(v,k))
        end
    end
    self:notify('on_init',hero)
    self:gc(hero:event '单位-攻击命中'(function(_,_,target)
        if self:is_cooling()==false and odd_run(self.odds) then
            self:active_cd()
            self:notify('on_run_start',hero,target,self.bind_skill)
            self:notify('on_run',hero,target,self.bind_skill)
            hero:notify('单位-攻击触发被动',hero,target,self.bind_skill)
        end
    end))
end

--兼容被动端口
function mt:on_run(hero,target,temp)
    temp.target = target
    temp:notify('on_cast_shot')
end
